Skip to content

fix: Correct metadata parsing for forced playback speed#3836

Merged
ImprovedTube merged 1 commit into
code-charity:masterfrom
hkzo:fix/forced-playback-speed-regex
May 16, 2026
Merged

fix: Correct metadata parsing for forced playback speed#3836
ImprovedTube merged 1 commit into
code-charity:masterfrom
hkzo:fix/forced-playback-speed-regex

Conversation

@hkzo
Copy link
Copy Markdown
Contributor

@hkzo hkzo commented May 6, 2026

Summary

This PR fixes metadata extraction in ImprovedTube.playerPlaybackSpeed() when "Permanent/Forced playback speed" is enabled and the playback speed is set above 1.

Video title changes were not always detected correctly because fetched metadata was parsed with a faulty regex.

Details

Fixed an issue where video title changes were not being correctly detected due to a faulty regex.

The subsequent logic expects property/value in match[1] and match[2], but the current regex captures them into match[2] and match[3]. This mismatch causes if (keywords) { ImprovedTube.speedException(); } to always evaluate to false, preventing music video detection.

Additionally, the code failed to extract the title from fetched content, leading to evaluations based on outdated metadata from the previous video.

Changes:

  • Exclude (name|itemprop) from capture groups to fix an index mismatch for property and value.
  • Update regex to match <meat name="title"> for extracting DATA.title from the fetched content.
  • Fixes the bug where ImprovedTube.speedException() is never triggered due to failed keyword retrieval.

Environment

  • Browser: Firefox Developer Edition 151 / Firefox 150
  • Extension: ImprovedTube 4.2026 (No other extensions installed)
  • OS: macOS 15.7

Fix an issue where ImprovedTube.speedException() is never called due to incorrect keyword retrieval.
Exclude (name|itemprop) from capture groups to fix an index mismatch for property and value.

Fix missing title updates from fetched content that cause the title to remain empty or outdated.
Update regex to match "title" for extracting DATA.title from the fetched content.
@improvedtube-backup
Copy link
Copy Markdown
Collaborator

nice! @hkzo thank you very much,

we may combine as one function:
getData() by @AryaXDG
and fetchDOMData() & fetchDOMData2() (slice can be an optional tuning parameter, heatmap also is at the end)

I may help several future features and components, such as showing a video's tags or history, or archiving all available metadata always.
And may intersect with https://github.com/LuanRT/YouTube.js/

( And before fetching http...youtube it could check if API key is available (probably rare yet), )




Data

Youtube category break down #1451 (temporarily offline as of #3804)

There also is <meta property="og:video:width" content="1280" & height;
og:image:width & height ( while og:image is more of a duplicate of the video ID i.ytimg.com/vi/___________/maxresdefault.jpg and the remaining duplicates might (always?) be useless. Not sure if meta property="og:video:tag" - is always identical to "keywords"?) and i might saw different title lengths before? meta name="twitter:title", meta property="og:title" meta property="og:type", meta property="og:description" , meta property="og:url" )

@ImprovedTube ImprovedTube merged commit 297ac86 into code-charity:master May 16, 2026
@improvedtube-backup
Copy link
Copy Markdown
Collaborator

Archive

I've taken 5000+ screenshots with this extension. would be nice if the filename includes the channel name.
also if possible, embed the description into the file.

hi @NazzzF good point (easy to predict too @ team) if you like to tell/ideas@improvedtube.com, what's your category break down and how many of the screenshots/timestamps would you like to publish too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants